package com.candy.service.impl;

import com.candy.bean.UserInfo;
import com.candy.dao.UserInfoMapper;
import com.candy.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {

//    Autowired注解实现自动装配
    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public boolean login(String username, String userpwd) {
//        调用持久层
       List<UserInfo> userinfoes= userInfoMapper.login(username,userpwd);
//       若用户名密码匹配，则集合不为空，则返回true
       if (userinfoes!=null&&userinfoes.size()>0){
           return true;
       }else {
//           若不匹配，返回false
           return false;
       }
    }
}
